<%@page import="blackboard.portal.external.*"
errorPage="/error.jsp"
%>
<%@ taglib uri="/bbUI" prefix="bbUI"%>
<%@ taglib uri="/bbNG" prefix="bbNG"%>
<%@ taglib uri="/bbData" prefix="bbData"%>
<bbData:context>
<bbUI:moduleAdminPage>

<%
CustomData cd = CustomData.getModuleData(pageContext);
// attempt save if something is on request (i.e. posted back to this page)
if (request.getParameter("aspireBaseUrl")!=null)
{
	cd.setValue("aspireBaseUrl",request.getParameter("aspireBaseUrl"));
	cd.setValue("targetNodeType",request.getParameter("targetNodeType"));
	cd.setValue("regexCourseId",request.getParameter("regexCourseId"));
	if (request.getParameter("debugMode")==null)
	{
		cd.setValue("debugMode","false");
	}
	else
	{
		cd.setValue("debugMode",request.getParameter("debugMode"));
	}
	cd.save();	
%>
	<bbUI:receipt title="Data saved successfully" iconUrl="/images/ci/icons/receiptsuccess_u.gif" buttonName="Dismiss">The module is now ready to use</bbUI:receipt>
<%
}

String aspireBaseUrl = cd.getValue("aspireBaseUrl");
if (aspireBaseUrl == null)
{
	aspireBaseUrl="";
}
String targetKg = cd.getValue("targetNodeType");
if (targetKg == null)
{
	targetKg="";
}
String regexCourseId = cd.getValue("regexCourseId");
if (regexCourseId == null)
{
	regexCourseId="";
}
String debugMode = cd.getValue("debugMode");
if (debugMode == null)
{
	debugMode="";
}
%>
<FORM method="post" action="admin.jsp">
<bbUI:step title="Enter your institution's Talis Aspire Base URL" number="1">
<bbUI:dataElement label="Base URL"><input type="text" size="100" name="aspireBaseUrl" value="<%=aspireBaseUrl%>"/></bbUI:dataElement>
<p>Enter your Talis Aspire base tenancy URL, e.g. 'http://lists.broadminsteruniversity.org'. Important: Do not add a trailing '/'</p>
</bbUI:step>
<bbUI:step title="Map Blackboard courses to a node type in Talis Aspire" number="2">
<bbUI:dataElement label="Node Type">
	<select name='targetNodeType'>
		<option value="courses" <% if (targetKg.equals("courses")) { out.print("selected=\"selected\"");} %>>Courses</option>
		<option value="modules" <% if (targetKg.equals("modules")) { out.print("selected=\"selected\"");} %>>Modules</option>
		<option value="units" <% if (targetKg.equals("units")) { out.print("selected=\"selected\"");} %>>Units</option>
		<option value="programmes" <% if (targetKg.equals("programmes")) { out.print("selected=\"selected\"");} %>>Programmes</option>
		<option value="subjects" <% if (targetKg.equals("subjects")) { out.print("selected=\"selected\"");} %>>Subjects</option>
	</select>
</bbUI:dataElement>
<p>In Talis Aspire, this will match the type of node do you usually attach lists to.</p>
</bbUI:step>
<bbUI:step title="Supply a regular expression to convert Blackboard course ID to the node code" number="3">
<bbUI:dataElement label="RegEx"><input type="text" name="regexCourseId" value="<%=regexCourseId%>"/></bbUI:dataElement>
<p>Leave this blank if your course IDs in Balckboard match exactly the code value in Aspire. Otherwise, specify a regular expression to trim the Blackboard course ID to the Talis Aspire equivalent.</p>
<p>For help on how to complete this step, contact <a href="mailto:support@talisaspire.com?subject=Help me configure the regex field for the Talis Aspire BBLearn 9 building block">support@talisaspire.com</a> quoting at least 3 example course IDs from your Blackboard System.</p>
</bbUI:step>
<bbUI:step title="Enable debug mode?" number="4">
<bbUI:dataElement label="Debug"><input type="checkbox" name="debugMode" value="true" <% if (debugMode.equals("true")) { out.print("checked=\"checked\"");} %>/></bbUI:dataElement>
<p>When checked, rather than making a live call to the Talis Aspire APIs, the system will instead output debug information on the configuration and parameters used to submit the call.</p>
<p>Never leave this checked in production.</p>
</bbUI:step>
<bbUI:stepSubmit title="Submit" number="5" />
</FORM>
</bbUI:moduleAdminPage>
</bbData:context>